package com.mysoft.service.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mysoft.common.DataSourceEnum;
import com.mysoft.common.annotation.DS;
import com.mysoft.common.entity.User;
import com.mysoft.dao.dao.UserMapper;
import com.mysoft.service.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: John
 * @Date 2019-12-18 22:59
 */
@Service
public class HelloServiceImpl extends ServiceImpl<UserMapper, User> implements HelloService {


    @Override
    @DS(DataSourceEnum.MASTER)
    public List<User> getAll() {
        QueryWrapper<Object> queryWrapper = new QueryWrapper<>();
        IPage<User> userIPage = baseMapper.selectPage(new Page<>(), null);
        return baseMapper.selectList(null);
    }

    @Override
    @DS(DataSourceEnum.ANTHER)
    public List<User> getAnther() {
        return baseMapper.selectList(null);
    }

    @Override
    public List<User> list() {
        return baseMapper.selectList(null);
    }

}
